#!/bin/bash

WORK_DIR=`pwd`
BUILD_DIR=${WORK_DIR}/build

function exec_all()
{
    cur_dir=`pwd`
    sub_dir=$1

    echo "${sub_dir}"

    cd ${sub_dir}

    for i in `ls | grep ^glib`
    do 
        cd $i
        echo "========================================="
        echo "#./$i"
        ./$i
        cd ..
    done
}

# compile
rm -rf ${BUILD_DIR}
mkdir ${BUILD_DIR}
cd ${BUILD_DIR}
cmake ..
make

# execute
for i in `ls | grep ^glib`
do
    #echo $i;
    exec_all ${BUILD_DIR}/$i
done
